home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / Dots & Pixels / headers / movingnoisedots.h < prev    next >
C/C++ Source or Header  |  1995-09-29  |  988b  |  42 lines

  1. #pragma once
  2. //
  3. // class movingnoisedots generates random dots which move at a given speed
  4. // in random directions which very at every timestep.
  5. //
  6. class movingnoisedots : public dotcollection,
  7.         public phaser, public screendots
  8. {
  9.     public:
  10.     
  11.         movingnoisedots( int numbits, int xpos, int ypos,
  12.                 int aantaldots, int lifetime, int noiseBits);
  13.         movingnoisedots( int numbits, screen_position where,
  14.                 int aantaldots, int lifetime, int noiseBits);
  15.  
  16.     protected:
  17.  
  18.         virtual void compute_addresses();
  19.  
  20.     private:
  21.         const unsigned long noiseMask;
  22.         const unsigned long noiseShift;
  23.         
  24.         void move_the_dots();
  25.         //
  26.         // we use 'short_long_hack' to split an unsigned long in two
  27.         // signed shorts (the unsigned long being returned by randomizer_step())
  28.         // (could move these to 'dotcollection' and add a member 'uniformize')
  29.         //
  30.         typedef struct two_shorts
  31.         {
  32.             short left;
  33.             short right;
  34.         };
  35.         
  36.         typedef union short_long_hack
  37.         {
  38.             two_shorts shorties;
  39.             unsigned long ulong;
  40.         };
  41. };
  42.